package com.cyzy.controller;

import com.cyzy.dao.Attend;
import com.cyzy.dto.Result;
import com.cyzy.pojo.CourseCla;
import com.cyzy.pojo.CourseStu;
import com.cyzy.service.AttendService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @Author: zengxiangwei
 * @CreateTime: 2025-06-20 下午2:37
 */
@RestController
@RequestMapping("/attend")
public class AttendController {
    @Autowired
    private AttendService attendService;

    //获取家长头像
    @RequestMapping("/getParentUrl")
    public Result getParentUrl(@RequestParam("parentId") String parentId,@RequestParam("campusId")String campusId){
        String parentUrl = attendService.getParentUrl(parentId,campusId);
        return Result.ok().data("parentUrl",parentUrl);
    }
    //获取学生信息
    @RequestMapping("/getCourseStu")
    public Result getCourseStu(@RequestParam("parentId") String parentId,@RequestParam("campusId")String campusId){
        List<CourseStu> list = attendService.getCourseStu(parentId,campusId);
        return Result.ok().data("list",list);
    }
    //获取班级信息
    @RequestMapping("/getCourseCla")
    public Result getCourseCla(@RequestParam("stuId") String stuId){
        List<CourseCla> list = attendService.getCourseCla(stuId);
        return Result.ok().data("list",list);
    }
    //获取学生班级考勤信息
    @RequestMapping("/getAttend")
    public Result getAttend(@RequestParam("stuId") String stuId,
                            @RequestParam("claId") String claId,
                            @RequestParam("month") String month){
        List<Attend> list = attendService.getAttend(stuId,claId,month);
        return Result.ok().data("list",list);
    }
    //获取学生班级指定日期的课时考勤信息
    @RequestMapping("/getAttendByDay")
    public Result getAttendByDay(@RequestParam("stuId") String stuId,
                            @RequestParam("claId") String claId,
                            @RequestParam("day") String day){
        List<Attend> list = attendService.getAttendByDay(stuId,claId,day);
        return Result.ok().data("list",list);
    }
}
